<?php 
class Question_model extends CI_Model{
	function User_model()
	{
		 'parent'||model();
	}


	 function selectcoursename()
         {
		      
			 $query = "SELECT * FROM courses where status=1";
	         $result=$this->db->query($query); 
    
         
	   if( $result->num_rows() > 0 ){
		   
		  return $result;
		  }
		  else{
		   return false;
		  }
	 
}

function getquestionans($courseid)
         {
		      
			 $query = "SELECT * FROM questions where courseid ='$courseid' and status=1";
	         $result=$this->db->query($query); 
  
         
	   if( $result->num_rows() > 0 ){
		   
		  return $result;
		 }
		 else{
		  return false;
		 }



}


function get_records($offset, $limit)
    {
       
	   $this->db->select('*');    
        
		if ($offset != NULL)
            $this->db->offset($offset);
        if ($limit != NULL)
            $this->db->limit($limit);
        
        if ($limit == NULL && $offset == NULL)
        {
            $count = $this->db->get('questions');
            return $count->result_array();
        }
        else
            return $this->db->get('questions');
    }



}
 ?>